﻿using System;
using Web7.Ioc;
using System.Collections.Generic;

namespace Web7.Core.Security
{
    public interface IAssistUserService<Tid> : IDependency
    {
        /// <summary>
        /// 检查用户的唯一性
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="email"></param>
        /// <returns></returns>
        bool VerifyUserUnicity(string userName, string email);


        /// <summary>
        /// 发送验证Email地址
        /// </summary>
        /// <param name="user"></param>
        /// <param name="createUrl"></param>
        void SendChallengeEmail(IUser user, Func<string, string> createUrl);

        /// <summary>
        /// 确认验证
        /// </summary>
        /// <param name="challengeToken"></param>
        /// <returns></returns>
        IUser ValidateChallenge(string challengeToken);

        /// <summary>
        /// 发送丢失密码Email
        /// </summary>
        /// <param name="usernameOrEmail"></param>
        /// <param name="createUrl"></param>
        /// <returns></returns>
        bool SendLostPasswordEmail(string usernameOrEmail, Func<string, string> createUrl);

        /// <summary>
        /// 验证丢失密码
        /// </summary>
        /// <param name="nonce"></param>
        /// <returns></returns>
        IUser ValidateLostPassword(string nonce);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IUser Get(Tid id);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IUser CreateUser(CreateUserParams createUserParams);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        IEnumerable<PermissionRecord> GetPermissionsForUser(Tid id);
    }

    public interface IAssistUserService : IAssistUserService<Guid>
    {

    }
}
